<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of FoMailConfirmation
 *
 * @author mssae-9
 */
class BoPaiementCarteBancaireCtrl extends jController {
    /*
     * envoi mail de confirmatioin
     */
    function index(){

        $rep = $this->getResponse('html');
        $rep->menusActifs = adminHtmlResponse::MENU_ANNONCES ;
        jClasses::inc('commun~parametre');

        //$id             = $this->intParam('choix-form', 0);
        if (isset($_SESSION['BO_SESS_FORMULE_CHOISIE'])){
            $search = unserialize($_SESSION['BO_SESS_FORMULE_CHOISIE']);
            $formule    = $search->formule;
            $recapPrix  = $search->recapPrix ;
        }

        jClasses::inc('annonce~annoncePaiementSrv');

        $rep->addJSLink($GLOBALS['gJConfig']->urlengine['basePath'].'design/front/js/popup.js');
        $rep->addJSLink($GLOBALS['gJConfig']->urlengine['basePath'].'design/front/js/pub.js');

        $nb_min         = 1; 
        $nb_max         = 10000;
        $nombre_cmd     = rand($nb_min,$nb_max);
        $tarif          = $recapPrix ;//annoncePaiementSrv::getTarif('2');
        $montant        = $tarif*100;
        $params         = parametre::get(PARAM_MAIL_PAIEMENT_CB);
        $vendeur        = $params->param_content;

        $pathregret = 'http://' . $_SERVER['SERVER_NAME'] . jUrl::get('annonce~BoPaiementCarteBancaire:regret');
        $pathmerci = 'http://' . $_SERVER['SERVER_NAME'] .  jUrl::get('annonce~BoAnnonce:editer');

        $rep->bodyTpl = 'annonce~BoPaiementCarteBancaire';
        $rep->body->assign('montant',round($montant));
        $rep->body->assign('tarif',$tarif);
        $rep->body->assign('nombre_cmd',$nombre_cmd);
        $rep->body->assign('vendeur',$vendeur);
        $rep->body->assign('pathregret',$pathregret);
        $rep->body->assign('pathmerci',$pathmerci);

        return $rep;
}

    /**
    * Fonction   de retour lors de paiement non effectué ou annulé
    */
    function regret() {

        $rep = $this->getResponse('html');
        $rep->menusActifs = adminHtmlResponse::MENU_ANNONCES ;

        $rep->bodyTpl = 'annonce~BoPaiementCarteBancaireRegret';
       
        return $rep;
    }

}

?>
